<html>
<head>
  <meta HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  <title>pandr.m</title>
<link rel="stylesheet" type="text/css" href="../../m-syntax.css">
</head>
<body>
<code>
<span class=defun_kw>function</span>&nbsp;<span class=defun_out>varargout&nbsp;</span>=&nbsp;<span class=defun_name>pandr</span>(<span class=defun_in>model,distrib</span>)<br>
<span class=h1>%&nbsp;PANDR&nbsp;Visualizes&nbsp;solution&nbsp;of&nbsp;the&nbsp;Generalized&nbsp;Anderson's&nbsp;task.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Synopsis:</span></span><br>
<span class=help>%&nbsp;&nbsp;h&nbsp;=&nbsp;pandr(model)</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Description:</span></span><br>
<span class=help>%&nbsp;&nbsp;It&nbsp;vizualizes&nbsp;solution&nbsp;of&nbsp;the&nbsp;Generalized&nbsp;Anderson's&nbsp;task&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;for&nbsp;bivariate&nbsp;input&nbsp;Gaussians.</span><br>
<span class=help>%&nbsp;&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;The&nbsp;input&nbsp;of&nbsp;the&nbsp;task&nbsp;are&nbsp;two&nbsp;sets&nbsp;of&nbsp;Gaussians&nbsp;which&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;describe&nbsp;the&nbsp;first&nbsp;and&nbsp;second&nbsp;class.&nbsp;The&nbsp;Gaussians&nbsp;are&nbsp;denoted&nbsp;as&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;the&nbsp;ellipses&nbsp;(shape&nbsp;-&gt;&nbsp;covariance,&nbsp;center&nbsp;-&gt;&nbsp;mean).&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;The&nbsp;output&nbsp;of&nbsp;the&nbsp;task&nbsp;is&nbsp;the&nbsp;linear&nbsp;classifier&nbsp;denoted&nbsp;as&nbsp;a&nbsp;line&nbsp;</span><br>
<span class=help>%&nbsp;&nbsp;separating&nbsp;the&nbsp;2D&nbsp;feature&nbsp;space.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Input:</span></span><br>
<span class=help>%&nbsp;&nbsp;model&nbsp;[struct]&nbsp;Linear&nbsp;classifier:</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;.W&nbsp;[2&nbsp;x&nbsp;1]&nbsp;Normal&nbsp;vector&nbsp;of&nbsp;the&nbsp;separating&nbsp;hyperplane.</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;.b&nbsp;[real]&nbsp;Bias&nbsp;of&nbsp;the&nbsp;hyperplane.</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;&nbsp;distrib&nbsp;[struct]&nbsp;Set&nbsp;of&nbsp;binary&nbsp;labeled&nbsp;Gaussians:</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;.Mean&nbsp;[2&nbsp;x&nbsp;ncomp]&nbsp;Mean&nbsp;vectors.</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;.Cov&nbsp;[2&nbsp;x&nbsp;2&nbsp;x&nbsp;ncomp]&nbsp;Covariance&nbsp;matrices.</span><br>
<span class=help>%&nbsp;&nbsp;&nbsp;.y&nbsp;[1&nbsp;x&nbsp;ncomp]&nbsp;Labels&nbsp;1&nbsp;or&nbsp;2.&nbsp;</span><br>
<span class=help>%</span><br>
<span class=help>%&nbsp;<span class=help_field>Output:</span></span><br>
<span class=help>%&nbsp;&nbsp;h&nbsp;[1&nbsp;x&nbsp;nobjects]&nbsp;Handles&nbsp;of&nbsp;used&nbsp;graphics&nbsp;objects.</span><br>
<span class=help>%&nbsp;&nbsp;</span><br>
<span class=help>%&nbsp;<span class=help_field>Example:</span></span><br>
<span class=help>%&nbsp;</span><br>
<hr>
<br>
<span class=help1>%&nbsp;<span class=help1_field>About:</span>&nbsp;Statistical&nbsp;Pattern&nbsp;Recognition&nbsp;Toolbox</span><br>
<span class=help1>%&nbsp;(C)&nbsp;1999-2003,&nbsp;Written&nbsp;by&nbsp;Vojtech&nbsp;Franc&nbsp;and&nbsp;Vaclav&nbsp;Hlavac</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://www.cvut.cz"&gt;Czech&nbsp;Technical&nbsp;University&nbsp;Prague&lt;/a&gt;</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://www.feld.cvut.cz"&gt;Faculty&nbsp;of&nbsp;Electrical&nbsp;Engineering&lt;/a&gt;</span><br>
<span class=help1>%&nbsp;&lt;a&nbsp;href="http://cmp.felk.cvut.cz"&gt;Center&nbsp;for&nbsp;Machine&nbsp;Perception&lt;/a&gt;</span><br>
<br>
<span class=help1>%&nbsp;<span class=help1_field>Modifications:</span></span><br>
<span class=help1>%&nbsp;4-may-2004,&nbsp;VF</span><br>
<span class=help1>%&nbsp;24-feb-2003,&nbsp;VF</span><br>
<span class=help1>%&nbsp;30-sep-2002,&nbsp;VF</span><br>
<br>
<hr>
[err,r,inx]&nbsp;=&nbsp;andrerr(&nbsp;model,&nbsp;distrib&nbsp;);<br>
<br>
[dim,&nbsp;ncomp&nbsp;]&nbsp;=&nbsp;size(&nbsp;distrib.Mean&nbsp;);<br>
<span class=keyword>for</span>&nbsp;i=1:ncomp,<br>
&nbsp;&nbsp;p(i)&nbsp;=&nbsp;exp(-0.5*r^2)/(2*pi*sqrt(det(distrib.Cov(:,:,i))));<br>
<span class=keyword>end</span><br>
<br>
h1&nbsp;=&nbsp;pgauss(&nbsp;distrib,&nbsp;{<span class=quotes>'p'</span>,p});<br>
h2&nbsp;=&nbsp;pline(&nbsp;model&nbsp;);<br>
<br>
<span class=keyword>if</span>&nbsp;<span class=stack>nargout</span>&nbsp;&gt;&nbsp;0,<br>
&nbsp;&nbsp;<span class=stack>varargout</span>{1}&nbsp;=&nbsp;[h1&nbsp;h2];<br>
<span class=keyword>end</span><br>
<br>
<span class=jump>return</span>;<br>
</code>
